{% extends "base.html" %}
{% block body %}
<div class="contact-info">
    
    <ol class="breadcrumb">
        <li><a href="{{ url_for('pic.home') }}">Home</a></li>
        <li><a href="{{ url_for('work.home') }}">Work</a></li>
        <li class="active">{{ title }}</li>
    </ol>

    <div class="contact-grids">
            <ul class="list3">
                <li>
                    <div class="extra-wrap">
                        {% for pic in pics %}
                        <div><img src="{{ pic.thumbnail_uri }}" />
                            <p>文件名: {{(pic.file_name)}}.{{ pic.file_type }} , 文件描述: {{pic.note | default('[ ]',True)}} , 分辨率: {{pic.resolution_hr()}} , 导入时间: {{pic.create_time}}
                            <input type="button" onclick="onDelete_dbrecord('{{pic.id}}');" class="btn btn-default btn-xs" value="删除"></p>
                            <hr />
                        </div>
                        {% endfor %}
                    </div>
                </li>
            </ul>

        <div class="clear"></div>
    </div>
</div>
{% endblock %}

{% block script %}
<script type="text/javascript">
function onDelete_dbrecord(pic_id) {
    var msg = "确定删除该图片吗？";
    if (confirm(msg)==true){

        $.ajax({
            url: "{{url_for('api.delete',choice='pic')}}",
            type: 'GET',
            async:false,
            data: 'id=' + pic_id,
            dataType:"json",
            success: function (result) {
                alert(result['info']);
                location.reload();
                }
        });
    } else {}
}
</script>
{% endblock %}